package com.jzo2o.foundations.controller.consumer;

import com.jzo2o.foundations.model.dto.response.ServeAggregationSimpleResDTO;
import com.jzo2o.foundations.model.dto.response.ServeAggregationTypeSimpleResDTO;
import com.jzo2o.foundations.model.dto.response.ServeCategoryResDTO;
import com.jzo2o.foundations.service.HomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 首页服务列表
 *
 * @Author mr.wu
 * @Date 2025/1/19 21:20
 */
@Api("首页服务列表展现")
@Slf4j

@RequestMapping("/customer/serve")
@RestController
public class FirstPageServeController {
    @Autowired
    private HomeService homeService;

    @ApiOperation("首页服务列表接口")
    @ApiImplicitParam(name = "regionId", value = "区域ID")
    @GetMapping("/firstPageServeList")
    public List<ServeCategoryResDTO> firstPageServeList(@RequestParam ("regionId") Long regionId) {
        return homeService.firstPageServeList(regionId);
    }

    @ApiOperation("区域服务类型接口")
    @ApiImplicitParam(name = "regionId", value = "区域ID")
    @GetMapping("/serveTypeList")
    public List<ServeAggregationTypeSimpleResDTO> serveTypeList(@RequestParam ("regionId") Long regionId) {
        return homeService.serveTypeList(regionId);
    }

    @ApiOperation("热门服务列表接口")
    @ApiImplicitParam(name = "regionId", value = "区域ID")
    @GetMapping("/hotServeList")
    public List<ServeAggregationSimpleResDTO> hotServeList(@RequestParam ("regionId") Long regionId) {
        return homeService.hotServeList(regionId);
    }

    @ApiOperation("服务详情接口")
    @ApiImplicitParam(name = "serveId", value = "服务ID")
    @GetMapping("/{id}")
    public List<ServeAggregationSimpleResDTO> getById(@RequestParam ("id") Long id) {
        return homeService.getById(id);
    }


}
